<?php
namespace app\index\controller;

use app\common\model\Chat;
use app\common\model\Info;
use app\common\model\Qqjob;
use app\common\model\Qqs;
use app\common\model\Gg;
use app\common\model\Users;
use app\common\model\Weblist;

class PcHtml extends Common
{
    public function _empty()
    {
        exit($this->fetch('pc/common/empty'));
    }

    function __construct()
    {
        parent:: __construct();
        if (!request()->isAjax()) {
            $this->assign('alert', '你想做什么?');
            $this->assign('url', '/');
            exit($this->fetch('pc/common/msg'));
        }
    }
	
	public function debug()
    {
        $data = input('');
		$is = [
				[
					'name' => '说说秒赞',
					'id' => 'zan'
				],[
					'name' => '说说秒评',
					'id' => 'reply'
				],[
					'name' => '自动说说',
					'id' => 'shuo'
				],[
					'name' => '转发说说',
					'id' => 'zf'
				],[
					'name' => '情侣空间',
					'id' => 'ql'
				],
				[
					'name' => '删除说说',
					'id' => 'del'
				],[
					'name' => '删除留言',
					'id' => 'delly'
				],[
					'name' => '花藤代养',
					'id' => 'ht'
				],[
					'name' => '手Q加速',
					'id' => 'mqq'
				],[
					'name' => '手游加速',
					'id' => 'sy'
				],[
					'name' => '群聊签到',
					'id' => 'qunqd'
				],[
					'name' => '空间签到',
					'id' => 'qd'
				],[
					'name' => '会员签到',
					'id' => 'hyqd'
				],
				[
					'name' => '黄钻签到',
					'id' => 'hzqd'
				],[
					'name' => '好莱坞签到',
					'id' => 'hlwqd'
				],[
					'name' => '大会员签到',
					'id' => 'dhyqd'
				],[
					'name' => '微视签到',
					'id' => 'wsqd'
				],[
					'name' => 'QQ运动',
					'id' => 'yundong'
				],[
					'name' => '空间人气',
					'id' => 'renqi'
				],[
					'name' => '网易云签到',
					'id' => 'wyqd'
				],[
					'name' => '互赞名片赞',
					'id' => 'hzmp'
				]
				];
        $job = Qqjob::where(
            [
                'qid' => $data['qid'],
                'type' => $data['type']
            ]
        )->find();
		foreach($is as $v){
			if($v['id']===$data['type']){
				if ($job['start'] == 0) {
					$result = '<title>'.$v['name'].' [手动执行]</title>
					<div class="app-content bg-bai">
						<div class="p5 f5" id="debugbody"><div class="w t-v t-c"><span class="pt6 pb10 mb10"><i class="icon icon-info f17 hui dl"></i><p class="f6 t-c mt4 hui">功能尚未开启，请开启后再执行</p></span></div></div>
					</div>';
				} else {
					$url = $this->qqtaskApi($data['type'], $data['qid']);
					$debug = file_get_contents($url);
					$result = '<title>'.$v['name'].' [手动执行]</title>
					<div class="app-content bg-bai">
						<div class="p5 f5" id="debugbody">
							'.$debug .'
						</div>
					</div>';
				}
			}
		}
        echo $result;
    }
	
	public function qqtaskApi($type, $qid)
    {
        $row = Qqs::findByqid($qid);
        $job = Qqjob::where('qid', '=', $qid)
            ->where('type', '=', $type)
            ->find();
        $skey = $row['skey'];
        $pskey = $row['pskey'];
        $qq = $row['qq'];
        switch ($type) {
            case 'zan':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $skey . '&pskey=' . $pskey . '&method=' . $job['xy'] . '&forbid=' . $job['list'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case'reply':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $skey . '&pskey=' . $pskey . '&method=' . $job['xy'] . '&content=' . $job['data'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'shuo':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $skey . '&pskey=' . $pskey . '&method=' . $job['xy'] . '&content=' . $job['data'] . '&tuid=' . $job['tuid'] . '&delete=' . $job['del'] . '&mode=' . $job['mode'] . '&img=' . $job['url'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'zf':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $skey . '&pskey=' . $pskey . '&method=' . $job['xy'] . '&nr=' . $job['data'] . '&uin=' . $job['list'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'qipao':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $skey . '&mode=' . $job['mode'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'ql':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $skey . '&mode=' . $job['mode'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'del':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $skey . '&pskey=' . $pskey . '&method=' . $job['mode'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'delly':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $skey . '&pskey=' . $pskey . '&method=' . $job['mode'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'renqi':
                $run_url = get_Domain() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'ly':
                $run_url = get_Domain() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'ht':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&pskey=' . $row['pskey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'mqq':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'sy':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'qunqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&pskey=' . $row['pskey'] . '&tuid=' . $job['tuid'] . '&con=' . $job['data'] . '&forbid=' . $job['list'] . '&poi=' . $job['url'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'qd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&pskey=' . $row['pskey'] . '&content=' . $job['data'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'blqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&superkey=' . $row['superkey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'qbqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'hyqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'lzqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&superkey=' . $row['superkey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'hzqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&pskey=' . $row['pskey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'fzqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
            case 'hlwqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
			case 'wsqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&pskey=' . $row['pskey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
			case 'dhyqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&pskey=' . $row['pskey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
			case 'renqi':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&runkey=' . md5(RUN_KEY) . '';
                break;
			case 'wyqd':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&username=' . $job['list'] . '&password=' . $job['data'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
			case 'yundong':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
			case 'hzmp':
                $run_url = Weblist::gjApiUrl() . 'Other/taskrun/app.php?act=' . $type . '&qq=' . $qq . '&skey=' . $row['skey'] . '&pskey=' . $row['pskey'] . '&runkey=' . md5(RUN_KEY) . '';
                break;
        }
        return $run_url;
    }
	
	public function qqlist($act)
    {
        switch ($act) {
            case 'list':
				$page = input('get.page');
				$pageSize = 15;
				$page = ($page < 1) ? 1 : $page;
				$pageSize = ($pageSize < 1 || $pageSize > 50) ? 10 : $pageSize;
				$select = Qqs::getMyQqList($this->userInfo['uid'],$page,$pageSize);
				$data=input();
				$list='';
				if($data['search']!=''){
					$msg='啊哦，没有搜索到QQ哦~';
				}elseif($data['mod']==0){
					$msg='啊哦，怎么一个QQ也没有~';
				}elseif($data['mod']==1){
					$msg='该分类下没有QQ哦~';
				}elseif($data['mod']==2){
					$msg='该分类下没有QQ哦~';
				}
				$qqList = $select;
				if($qqList['total']==0){
					$list .='<div class="pt12 t-c f8 hui">'.$msg.'</div>';
				}else{
					foreach ($qqList['list'] as $row) {
						$is_zan_row = Qqjob::where(['type' => 'zan', 'qq' => $row['qq']])->find();
						$row['cookiezt'] = cookieZt($row['cookiezt']);
						if ($row['cookiezt'] == '正常') {
							$color = 'lv';
						} else {
							$color = 'hong';
						}
						if ($is_zan = is_zan($is_zan_row)) {
							if ($is_zan == '秒赞运行中') {
								$color2 = 'lv';
							} else {
								$color2 = 'hong';
							}
						}
						$list .= '<dl class="h13 del'.$row['qid'].'"> <a class="in h" href="'.url('pc/index',['act'=>'user','s'=>'qqset']).'?qid='.$row['qid'].'" data-pjax> <dt><img class="w9 h9 b r5 ml6 mr6" src="//q4.qlogo.cn/headimg_dl?dst_uin='.$row['qq'].'&spec=40"></dt> <dd> <div class="t-v"> <span class="col-4"> <p class="hui" style="padding-left:1px;"><i class="icon icon-my mr1"></i> '.get_qqnick($row['qq']).'</p> <p class="mt0 f5 dzi bold"><i class="icon icon-qq"></i> <font class="">'.$row['qq'].'</font></p> </span> <span class="col-4 f4 bold"><font class="'.$color.'"><i class="icon icon-squarecheck f4 mr1"></i> 状态：'.$row['cookiezt'].'</font></span> <span class="col-4 f3"> <p><i class="icon icon-appreciate mr1 hui"></i> <font class="'.$color2.'">'.$is_zan.'</font></p> <p class="mt0 hui"><i class="icon icon-time mr1"></i> ' . $row['time'] . '</p> </span> </div> </dd> </a> <dt><button class="btn btn-bai w13 h" onclick="mode_qq_add(\'qqlist\',\''.$row['qid'].'\');"><i class="icon icon-update"></i></button></dt> <dt><button class="btn btn-bai w13 h" onclick="mode_qq_mzrz(\''.$row['qq'].'\');"><i class="icon icon-medal"></i></button></dt> <dt><button class="btn btn-bai w13 h" onclick="ajax_qq_del(\'qqlist\',\''.$row['qid'].'\');"><i class="icon icon-delete"></i></button></dt> </dl>';
					}
				}
				$list .='<script>page.setcount('.$qqList['total'].',\'index\');</script>';
				echo $list;
                break;
			case 'set':
				$qid = input('qid');
                $qqrow = Qqs::where('qid', '=', $qid)
				->where('uid', '=', $this->userInfo['uid'])
				->find();
				if(Qqs::isQqZt($qqrow['qid'])) {
					$zt = '<font style="color:hsl(150,100%,50%);">QQ在线状态：正常在线中</font>';
				} else {
					$zt = '<font style="color:hsl(0,100%,50%);">QQ在线状态：状态已失效</font>';
				}	
				$this->assign('row', $qqrow);
				$this->assign('zt', $zt);
				$list = Qqjob::myAddGnList($qqrow['qq']);
				$kq_gn_list='';
				foreach ($list as $row) {
					if ($row['start'] == 1 && $row['cookiezt'] == 0) {
						$is_ = 'checked="checked"';
						$is_color = 'lv';
					} else {
						$is_ = '';
						$is_color = 'hong';
					}
					if ($row['type'] == 'auto') {
						$login_type = Qqs::findByqid($row['qid']);
						if ($login_type['type'] == 0) {
							$istype = '扫码登录';
						} else {
							$istype = '密码登录';
						}
						$kq_gn_list .= '<dl class="h12" id="isauto"> <dt><img class="w9 h9 ml4 mr3" src="/Static/img/isauto.png"></dt> <dt> <p class="lan bold"><i class="icon icon-dian lv"></i> 状态更新 <font class="ml2 f3 hui nobold">[' . $istype . ']</font></p> <p class="mt1 f3 hui" style="padding-left:1px;"><i class="icon icon-time f3 nobold"></i> ' . $row['lasttime'] . '</p> </dt> <dt><button class="btn btn-bai w12 h ml3" onclick="x.tip(\'[24H自动] 当QQ状态失效时，自动更新QQ在线状态\');"><i class="icon icon-info hui dl nobold"></i></button></dt> <dd> <div class="t-v"> <div class="col-3"></div> <div class="col-9 f3 hui pr5"></div> </div> </dd> <dt><div class="w12 h"></div></dt> <dt><div class="pl5 pr5"><label class="i-switch i-switch-lg bg-lan" onclick="x.btn(\'状态更新无法关闭\',\'本站已为所有用户开启了打码更新功能<br>保障您的QQ在线状态一直处于正常在线\');"> <input type="checkbox" checked="checked" disabled=""> <i></i> </label></div></dt> </dl>';
					}
					if ($row['type'] == 'zan') {
						$is_type_name = '说说秒赞';
						$is_type_title = '[24H自动] 为QQ空间好友发表的动态进行点赞';
						$mzcount= Qqjob::QqMzNum($row['qq']);
					}
					if ($row['type'] == 'hzmp') {
						$is_type_name = '互赞名片赞';
						$is_type_title = '[24H自动] 每天自动与网站用户QQ互赞名片赞1000次';
					}
					if ($row['type'] == 'reply') {
						$is_type_name = '说说秒评';
						$is_type_title = '[24H自动] 评论QQ空间好友发表的动态';
					}
					if ($row['type'] == 'qunqd') {
						$is_type_name = 'Q群签到';
						$is_type_title = '每天进行QQ群签到';
					}
					if ($row['type'] == 'mqq') {
						$is_type_name = '手机加速';
						$is_type_title = '加速QQ升级,需要是QQ会员且QQ绑定了手机';
					}
					if ($row['type'] == 'sy') {
						$is_type_name = '手游加速';
						$is_type_title = '玩10分钟手游加0.2天QQ活跃天加速QQ升级';
					}
					//New
					if ($row['type'] == 'shuo') {
						$is_type_name = '自动说说';
						$is_type_title = '离线自动发布说说';
                    }
                    if ($row['type'] == 'zf') {
						$is_type_name = '转发说说';
						$is_type_title = '离线自动转发好友说说';
                    }
                    if ($row['type'] == 'ql') {
						$is_type_name = '情侣积分';
						$is_type_title = '每天刷满情侣空间积分';
                    }
					if ($row['type'] == 'del') {
						$is_type_name = '删除说说';
						$is_type_title = '自动删除说说,仅保留最新10条';
                    }
                    if ($row['type'] == 'delly') {
						$is_type_name = '删除留言';
						$is_type_title = '开启任务会逐渐清空留言板';
                    }
					if ($row['type'] == 'ht') {
						$is_type_name = '花藤代养';
						$is_type_title = '每日花藤各项进行浇灌';
                    }
					if ($row['type'] == 'qd') {
                        $is_type_name = '空间签到';
						$is_type_title = '每天进行QQ空间签到';
                    }
					if ($row['type'] == 'hyqd') {
                        $is_type_name = '会员签到';
						$is_type_title = '每天进行QQ会员签到';
                    }
					if ($row['type'] == 'hzqd') {
                        $is_type_name = '黄钻签到';
						$is_type_title = '每天进行黄钻签到';
                    }
					if ($row['type'] == 'hlwqd') {
                        $is_type_name = '好莱坞签到';
						$is_type_title = '每天进行好莱坞会员签到';
                    }
					if ($row['type'] == 'dhyqd') {
                        $is_type_name = '大会员签到';
						$is_type_title = '每天进行QQ大会员签到';
                    }
					if ($row['type'] == 'wsqd') {
                        $is_type_name = '微视签到';
						$is_type_title = '每天进行微视签到';
                    }
					if ($row['type'] == 'yundong') {
                        $is_type_name = 'QQ运动';
						$is_type_title = '每天QQ运动打卡';
                    }
					if ($row['type'] == 'renqi') {
                        $is_type_name = '空间人气';
						$is_type_title = '每天互刷10个空间访客';
                    }
					if ($row['type'] == 'wyqd') {
                        $is_type_name = '网易云签到';
						$is_type_title = '每天进行网易云音乐打卡签到';
                    }
					if ($row['type'] !== 'auto') {
						if($row['type']=='zan'){
							$kq_gn_list .= '<dl class="h12" id="is'.$row['type'].'">
							<dt><img class="w9 h9 ml4 mr3" src="/Static/img/is'.$row['type'].'.png"></dt>
							<dt><p class="lan bold"><i class="icon icon-dian ' . $is_color . '"></i> '.$is_type_name.' <font class="ml2 f3 hong nobold">[<a class="hong" href="javascript:;" onclick="x.mode(\''.url('pc_html/debug').'?type='.$row['type'].'&amp;qid='.$row['qid'].'\',\'sdrun\');">手动执行</a>]</font>
							</p>
								<p class="mt1 f3 hui" style="padding-left:1px;"><i class="icon icon-time f3 nobold"></i> ' . $row['lasttime'] . '
								</p></dt>
							<dt>
								<button class="btn btn-bai w12 h ml3" onclick="x.tip(\''.$is_type_title.'\');"><i class="icon icon-info hui dl nobold"></i></button>
							</dt>
							<dd>
								<div class="t-v">
									<div class="col-3"></div>
									<div class="col-4 f3 hui pr5"><p>已积累秒赞:'.$mzcount.'次</p></div>
								</div>
							</dd>
							<dt>
								<button class="btn btn-bai w12 h" onclick="x.mode(\''.url('pc_html/gnset',['act'=>$row['type']]).'?qid='. $row['qid'] .'\',\'gnset'.$row['type'].'\');"><i class="icon icon-settings hui dl nobold"></i></button>
							</dt>
							<dt>
								<div class="pl5 pr5"><label class="i-switch i-switch-lg bg-lan" onclick="x.mode(\''.url('pc_html/gnset',['act'=>$row['type']]).'?qid='. $row['qid'] .'\',\'gnset'.$row['type'].'\');"> <input type="checkbox" ' . $is_ . ' disabled=""> <i></i>
								</label></div>
							</dt>
						</dl>';
						}elseif($row['type']=='reply' || $row['type']=='shuo' || $row['type']=='zf' || $row['type']=='ql' || $row['type']=='qunqd' || $row['type']=='qd' || $row['type']=='wyqd'){
							$kq_gn_list .= '<dl class="h12" id="is'.$row['type'].'">
							<dt><img class="w9 h9 ml4 mr3" src="/Static/img/is'.$row['type'].'.png"></dt>
							<dt><p class="lan bold"><i class="icon icon-dian ' . $is_color . '"></i> '.$is_type_name.' <font class="ml2 f3 hong nobold">[<a class="hong" href="javascript:;" onclick="x.mode(\''.url('pc_html/debug').'?type='.$row['type'].'&amp;qid='.$row['qid'].'\',\'sdrun\');">手动执行</a>]</font>
							</p>
								<p class="mt1 f3 hui" style="padding-left:1px;"><i class="icon icon-time f3 nobold"></i> ' . $row['lasttime'] . '
								</p></dt>
							<dt>
								<button class="btn btn-bai w12 h ml3" onclick="x.tip(\''.$is_type_title.'\');"><i class="icon icon-info hui dl nobold"></i></button>
							</dt>
							<dd>
								<div class="t-v">
									<div class="col-3"></div>
									<div class="col-4 f3 hui pr5"><p></p></div>
								</div>
							</dd>
							<dt>
								<button class="btn btn-bai w12 h" onclick="x.mode(\''.url('pc_html/gnset',['act'=>$row['type']]).'?qid='. $row['qid'] .'\',\'gnset'.$row['type'].'\');"><i class="icon icon-settings hui dl nobold"></i></button>
							</dt>
							<dt>
								<div class="pl5 pr5"><label class="i-switch i-switch-lg bg-lan" onclick="x.mode(\''.url('pc_html/gnset',['act'=>$row['type']]).'?qid='. $row['qid'] .'\',\'gnset'.$row['type'].'\');"> <input type="checkbox" ' . $is_ . ' disabled=""> <i></i>
								</label></div>
							</dt>
						</dl>';
						}else{
							$kq_gn_list .= '<dl class="h12" id="is'.$row['type'].'">
							<dt><img class="w9 h9 ml4 mr3" src="/Static/img/is'.$row['type'].'.png"></dt>
							<dt><p class="lan bold"><i class="icon icon-dian ' . $is_color . '"></i> '.$is_type_name.' <font class="ml2 f3 hong nobold">[<a class="hong" href="javascript:;" onclick="x.mode(\''.url('pc_html/debug').'?type='.$row['type'].'&amp;qid='.$row['qid'].'\',\'sdrun\');">手动执行</a>]</font>
							</p>
								<p class="mt1 f3 hui" style="padding-left:1px;"><i class="icon icon-time f3 nobold"></i> ' . $row['lasttime'] . '
								</p></dt>
							<dt>
								<button class="btn btn-bai w12 h ml3" onclick="x.tip(\''.$is_type_title.'\');"><i class="icon icon-info hui dl nobold"></i></button>
							</dt>
							<dd>
								<div class="t-v">
									<div class="col-3"></div>
									<div class="col-9 f3 hui pr5"><p></p></div>
								</div>
							</dd>
							<dt>
								<button class="btn btn-bai w12 h" onclick="x.del(\''.url('pc_ajax/gnset',['act'=>'delete']).'\',\'qid='. $row['qid'] .'&amp;xm='.$row['type'].'\');"><i class="icon icon-delete hui dl nobold"></i></button>
							</dt>
							<dt>
								<div class="pl5 pr5"><label class="i-switch i-switch-lg bg-lan"> <input type="checkbox"   ' . $is_ . ' onclick="x.ajax(\''.url('pc_ajax/gnset',['act'=>$row['type']]).'\',\'qid='. $row['qid'] .'\',1);">
									<i></i> </label></div>
							</dt>
						</dl>';
						}
					}

				}
				$this->assign('gnlist', $kq_gn_list);
				echo $this->fetch('/pc/html/qqset');
				break;
        }
    }
	
	public function gnset($act)
    {
        switch ($act) {
			case 'zan':
                $qid = input('get.qid');
                $job = Qqjob::where('qid', '=', $qid)->where('type', '=', 'zan')->find();
                $this->assign('job', $job);
                echo $this->fetch('/pc/html/gnset/zan');
                break;
            case 'reply':
                $qid = input('get.qid');
                $job = Qqjob::where('qid', '=', $qid)->where('type', '=', 'reply')->find();
                $this->assign('job', $job);
                echo $this->fetch('/pc/html/gnset/reply');
                break;
            case 'qunqd':
                $qid = input('get.qid');
                $job = Qqjob::where('qid', '=', $qid)->where('type', '=', 'qunqd')->find();
                $this->assign('job', $job);
                echo $this->fetch('/pc/html/gnset/qunqd');
                break;
			case 'shuo':
                $qid = input('get.qid');
                $job = Qqjob::where('qid', '=', $qid)->where('type', '=', 'shuo')->find();
                $this->assign('job', $job);
                echo $this->fetch('/pc/html/gnset/shuo');
                break;
            case 'zf':
                $qid = input('get.qid');
                $job = Qqjob::where('qid', '=', $qid)->where('type', '=', 'zf')->find();
                $this->assign('job', $job);
                echo $this->fetch('/pc/html/gnset/zf');
                break;
            case 'ql':
                $qid = input('get.qid');
                $job = Qqjob::where('qid', '=', $qid)->where('type', '=', 'ql')->find();
                $this->assign('job', $job);
                echo $this->fetch('/pc/html/gnset/ql');
                break;
            case 'qd':
                $qid = input('get.qid');
                $job = Qqjob::where('qid', '=', $qid)->where('type', '=', 'qd')->find();
                $this->assign('job', $job);
                echo $this->fetch('/pc/html/gnset/qd');
                break;
			case 'wyqd':
                $qid = input('get.qid');
                $job = Qqjob::where('qid', '=', $qid)->where('type', '=', 'wyqd')->find();
                $this->assign('job', $job);
                echo $this->fetch('/pc/html/gnset/wyqd');
                break;
		}
	}
	
	public function other($act)
    {
        switch ($act) {
			case 'mzrz':
				$qq = input('qq');
                $where['start'] = ['<>', 0];
                $row = Qqjob::where([
                    'qq' => $qq,
                    'cookiezt' => 0
                ])
                    ->where($where)
                    ->find();
                $user = Users::where('uid', '=', $row['uid'])
                    ->find();
                if (empty($qq)) {
                    echo '请输入QQ号';
                } elseif ($row) {
                    if ($row['server'] == 1) {
                        $server = '免费服务器';
                        $sd = config('sys_server_sd');
                    } elseif ($row['server'] == 2) {
                        $server = 'VIP服务器';
                        $sd = config('sys_vid_server_sd');
                    } else {
                        $server = '急速服务器';
                        $sd = config('sys_js_server_sd');
                    }
					echo '<title>QQ' . $qq . '的秒赞认证</title><div class="w67 p3 m4 bg-bai dl2 b b-hui rx4"><div class="f8 hei"><img class="w9 h9 b b-hui r5 mr4" src="//q1.qlogo.cn/g?b=qq&nk=' . $qq . '&s=100&t=327">' . get_qqnick($qq) . '</div><div class="mt4"><font class="hui">秒赞 QQ ： </font><font class="bold dzi">' . $qq . '</font></div><div class="mt2"><font class="hui">秒赞状态 ：</font><font class="bold lv">已开启 - '.$server.'</font></div><div class="mt2"><font class="hui">秒赞会员 ：</font>' . is_Vip($user['viptime']) . '<span class="ml2"><font color="red"></font></span></div><div class="mt2"><font class="hui">底赞数量 ：</font><span class="bold cheng">' . mt_rand(50, 600) . '</span></div><div class="mt5 hui">查询时间 ：' . $this->date . '</div><div class="mt2 f3 hui">'.config('web_webname').'（'.$_SERVER['HTTP_HOST'].'）为您的秒赞保驾护航</div></div>';
                } else {
                    echo '<title>QQ' . $qq . '的秒赞认证</title><div class="w67 p3 m4 bg-bai dl2 b b-hui rx4"><div class="f8 hei"><img class="w9 h9 b b-hui r5 mr4" src="//q1.qlogo.cn/g?b=qq&nk=' . $qq . '&s=100&t=327"> No Mz</div><div class="mt4"><font class="hui">查询 QQ ：</font><font class="bold dzi">' . $qq . '</font></div><div class="mt2"><font class="hui">秒赞状态 ：</font><font class="bold">未开启</font></div><div class="mt2"><font class="hui">秒赞信息 ：</font>尚未在'.config('web_webname').'开启秒赞功能</div><div class="mt5 hui">查询时间 ：2020-03-27 21:07:21</div><div class="mt2 f3 hui">'.config('web_webname').'（'.$_SERVER['HTTP_HOST'].'）为您的秒赞保驾护航</div></div>';
                }
				break;
			case 'mzrz_so':
				$qq = input('qq');
                $where['start'] = ['<>', 0];
                $row = Qqjob::where([
                    'qq' => $qq,
                    'cookiezt' => 0
                ])
                    ->where($where)
                    ->find();
                $user = Users::where('uid', '=', $row['uid'])
                    ->find();
                if (empty($qq)) {
                    echo '请输入QQ号';
                } elseif ($row) {
                    if ($row['server'] == 1) {
                        $server = '免费服务器';
                        $sd = config('sys_server_sd');
                    } elseif ($row['server'] == 2) {
                        $server = 'VIP服务器';
                        $sd = config('sys_vid_server_sd');
                    } else {
                        $server = '急速服务器';
                        $sd = config('sys_js_server_sd');
                    }
					echo '<script>x.getval("#mzrzqq",null);$("#mzrzinquiryresult").html(\'<title>QQ' . $qq . '的秒赞认证</title><div class="w23 p6 bg-bai dl2 b b-hui rx4"><div class="f8 hei"><img class="w9 h9 b b-hui r5 mr4" src="//q1.qlogo.cn/g?b=qq&nk=' . $qq . '&s=100&t=327">' . get_qqnick($qq) . '</div><div class="mt4"><font class="hui">秒赞 QQ ： </font><font class="bold dzi">' . $qq . '</font></div><div class="mt2"><font class="hui">秒赞状态 ：</font><font class="bold lv">已开启 - '.$server.'</font></div><div class="mt2"><font class="hui">秒赞会员 ：</font>' . is_Vip($user['viptime']) . '<span class="ml2"><font color="red"></font></span></div><div class="mt2"><font class="hui">底赞数量 ：</font><span class="bold cheng">' . mt_rand(50, 600) . '</span></div><div class="mt5 hui">查询时间 ：' . $this->date . '</div><div class="mt2 f3 hui">'.config('web_webname').'（'.$_SERVER['HTTP_HOST'].'）为您的秒赞保驾护航</div></div>\')';
                } else {
					echo '<script>x.getval("#mzrzqq",null);$("#mzrzinquiryresult").html(\'<title>QQ' . $qq . '的秒赞认证</title><div class="w23 p6 bg-bai dl2 b b-hui rx4"><div class="f8 hei"><img class="w9 h9 b b-hui r5 mr4" src="//q1.qlogo.cn/g?b=qq&nk=' . $qq . '&s=100&t=327"> No Mz</div><div class="mt4"><font class="hui">查询 QQ ：</font><font class="bold dzi">' . $qq . '</font></div><div class="mt2"><font class="hui">秒赞状态 ：</font><font class="bold">未开启</font></div><div class="mt2"><font class="hui">秒赞信息 ：</font>尚未在'.config('web_webname').'开启秒赞功能</div><div class="mt5 hui">查询时间 ：2020-03-27 21:07:21</div><div class="mt2 f3 hui">'.config('web_webname').'（'.$_SERVER['HTTP_HOST'].'）为您的秒赞保驾护航</div></div>\')';
                }
				break;
			case 'dlyz':
				$uin = input('post.qq');
				$check=Users::dlyz($uin);
				if($check['code']==0){
					echo '<script>x.getval("#dailiqq",null);$("#dlyzinquiryresult").html(\'<p class="f6 bold">查询结果：</p><br><p class="lv">该QQ('.$uin.')通过了'.config('web_webname').'的代理验证，可放心交易。</p>\');</script>';
				}else{
					echo '<script>x.getval("#dailiqq",null);$("#dlyzinquiryresult").html(\'<p class="f6 bold">查询结果：</p><br><p class="hong">该QQ('.$uin.')不是'.config('web_webname').'的代理，请结束交易。</p>\');</script>';
				}
				break;
			case 'mzq':
                $type = input('get.type');
                $load_list = Qqjob::
                where('server', '=', $type)
                    ->where('type', '=', 'zan')
                    ->order('lasttime desc')
                    ->limit(200)
                    ->select();
                if ($load_list) {
                    foreach ($load_list as $qq) {
						$qq_row = Qqs::where(['qq' => $qq['qq']])->find();
						$mzcount= Qqjob::QqMzNum($qq['qq']);
						if ($is_zan = is_zan($qq)) {
							if ($is_zan == '秒赞运行中') {
								$color = 'lv';
							} else {
								$color = 'hong';
							}
						}
                        echo ' <dl class="p4"> <dt><img class="w9 h9 b r5 ml1 mr5" src="https://q4.qlogo.cn/headimg_dl?dst_uin=' . $qq['qq'] . '&spec=100"></dt> <dd> <div class="t-v"> <div class="col-4"> <p class="f3 hui" style="padding-left:1px;"><i class="icon icon-my mr1"></i> '.get_qqnick($qq['qq']).'</p> <p class="mt0 dzi bold"><i class="icon icon-qq"></i> <font class="">'.$qq['qq'].'</font></p> </div> <div class="col-4 f3"> <p><i class="icon icon-appreciate mr1"></i> <font class="'.$color.'">'.$is_zan.'</font></p> <p class="mt0 hui"><i class="icon icon-time mr1"></i> ' . $qq_row['time'] . '</p> </div> <div class="col-4 f3 hui"> <p>积累秒赞：'.$mzcount.'次</p> </div> </dd> <dt><a class="btn btn-sm btn-hei dl btn-1 rx1 mr3" href="tencent://AddContact/?fromId=45&fromSubId=1&subcmd=all&uin=' . $qq['qq'] . '&website=mz.emapi.cn" target="_blank">加好友</a></dt> <dt><a class="btn btn-sm btn-fen dl btn-1 rx1 mr3" href="http://' . $qq['qq'] . '.qzone.qq.com" target="_blank">看空间</a></dt> </dl> ';
                    }
                }
                break;
			case 'qd':
				$qqlist=Qqs::getMyQqList($this->userInfo['uid'],1,100);
				$list='';
				foreach ($qqlist['list'] as $row) {
					if(Qqs::isQqZt($row['qid'])) {
						$zt = '<font class="lv">正常</font>';
					} else {
						$zt = '<font class="cheng">失效</font>';
					}	
					$list .= '<dl class="in p4" onclick="x.ajax(\''.url('user_ajax/other',['act'=>'qds']).'\',\'qid=' . $row['qid'] . '\',\'正在签到，请稍等...\');"> 
					<dt><img class="w9 h9 b r5 ml2 mr4" src="https://q4.qlogo.cn/headimg_dl?dst_uin=' . $row['qq'] . '&spec=100"></dt> <dd> <p class="hui" style="padding-left:1px;"><i class="icon icon-my mr1"></i> '.get_qqnick($row['qq']).'</p> <p class="mt0 f5 dzi bold"><i class="icon icon-qq"></i> <font class="">' . $row['qq'] . '</font></p> </dd> <dt class="pl3 pr3 f3">'.$zt.'</dt> <dt><i class="icon icon-pright hui"></i></dt> </dl> ';
				}
				echo '<title>选择一个QQ进行签到</title> 
				<div class="in-list in-b"> <dl>
				<p class="p4 hong bold">注：签到会在你所选择的QQ空间内发布一条本平台的推广广告说说，如不能接受，请勿签到</p>
				</dl>'.$list.'</div>';
				break;
		}
	}
	
	protected
    function _initialize()
    {
        parent::_initialize();
        $this->checkLogin();
		
    }
	
	private
    function checkLogin()
    {
        $check_Login = Users::checkLogin();
        if ($check_Login != null) {
            $this->assign('alert', $check_Login['msg']);
            $this->assign('url', $check_Login['url']);
            exit($this->fetch('pc/common/msg'));
        } else {
            $this->userInfo = Users::getLoginUser();
            $this->assign('userInfo', $this->userInfo);

        }
    }
}